import axios from 'axios'
// import router from './router'
var instance = axios.create({
    // baseURL: process.env.API_ROOT,
    // timeout: 5000,
  });


  //添加请求拦截
  instance.interceptors.request.use(config=>{
    // config.headers['token'] = 'SESSIONID=2024350C26093BB10CC9AC4BF6FDFBFF'
    config.headers['Content-Type'] = 'application/json;charset=UTF-8'
    return config
  },error=>{
      return Promise.reject(error)
  })

  // 添加响应拦截器
instance.interceptors.response.use(response=>{
    if(response.data.code == 3){
        // window.location.href ='/#/dialog'
        // debugger
    //    this.$router.push('/dialog')
       alert(response.data.msg)
    }
   return response.data
},error=>{
    // var str = error + ''
    return Promise.reject(error)
})

export default instance
